# 类
class student():
    # 初始函数-构造函数
    # self - this（关键字）
    def __init__(self,name,age):
        self.name = name
        self.age = age
    def show(self):
        print(self.name,self.age)

stu = student("zhangsan",13)
print(stu.name)
print(stu.age)
stu.show()

# 受保护的 protected
class user():
    def __init__(self,name,age):
        self.name = name
        self.age = age
        self._sex = "男"
    def show(self):
        print(self.name,self.age,self._sex)
user1 = user("lisi",23)
user1.show()
print(user1.sex)

# 私有的 private  只能在函数内部使用
class dog():
    def __init__(self,name,age):
        self.name = name
        self.age = age
        self.__color = "白色"

    def show(self):
        print(self.name,self.age,self.__color)
dog1 = dog("十九",4)
dog1.show()
# 调用对外的方法进行查询
# print(dog1.__color)



